<%@page import="model.constraints.synthesized.attributes.SyntAttributesAbstract"%>
<%@ page import="model.validator.*"%>
<%@ page import="model.constraints.*"%>
<%@ page import="model.constraints.synthesized.*"%>
<%@ page import="model.constraints.inherited.*"%>
<%@ page import="java.util.Stack"%>
<%@ page import="java.util.Vector"%>
<%@ page import="java.util.HashMap"%>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>XML Validation</title>
<!--[if lt IE 9]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link href="${initParam.url}css/styles.css" rel="stylesheet" type="text/css">
</head>
<body>
<div id="box" style="width: 100%;"> 
<div id="box-content" style="width: 90%;"> 
	
	<%
 			int id = Integer.parseInt(request.getParameter("id")); 
 				if(request.getParameter("id") != null){
 			
 		            int i=0; 
 		            String key = new String();
 		              
 		          	HashMap<String, ValidateSaxParse> validate = (HashMap<String, ValidateSaxParse>) session.getAttribute("validate");
 		  	        	for (String k : validate.keySet()) 
 		  	        		key = k;
 		  	       
 			Stack<Vector<SyntAttributesAbstract>> synt = new Stack<Vector<SyntAttributesAbstract>>();	            	  
 			AbstractConstraint ab = (AbstractConstraint) validate.get(key).getConstraints().get(id).getConstraint();
 			synt = (Stack<Vector<SyntAttributesAbstract>>) validate.get(key).getConstraints().get(id).getStackSynt();
 		%>
	
	<table class="more-results">
		<tr>
			<th>Constraint Name</th>
			<th>Result Validation</th>            
		</tr>
		<tr>
			<td><%= ab.getNameConstraint() %></td>
			<td><%= synt.peek().get(0).getC().toString() %></td>            
		</tr>
	</table>  
	
    <table class="more-results">
		<tr>
			<th>Summary</th>
		</tr>
		<tr>
			<td><%= validate.get(key).getConstraints().get(id).getResult() %></td>                                
		</tr>
	</table> 
    
    <%
    	String errors = validate.get(key).getConstraints().get(id).getErrosConstraint();
    
    	if(!errors.equals("")){    
    %>
	<table class="more-results more-results-error">
		<tr>
			<th>Errors</th>
		</tr>
		<tr>
			<td><%= errors %></td>
		</tr>
	</table>      
	
	<% } %>
	
        
	<table class="more-results">
		<tr>
			<th>Descriptions</th>
		</tr>
		<tr>
			<td><%= ab.toStringPath() %></td>
		</tr>
	</table>
    
	<table class="more-results">
		<tr>
			<th>Automata</th>
		</tr>
		<tr>
			<td><%= ab.toString() %></td>
		</tr>		
	</table> 
	
		<% 
		XDFCValidate val = (XDFCValidate) validate.get(key).getConstraints().get(id);
		if (!val.getInvalidConditions().equals("")){ %>
		<table class="more-results more-results-error">
			<tr>
				<th>Invalid Conditions</th>
			</tr>
			<tr>
				<td><%= val.getInvalidConditions() %></td>
			</tr>		
		</table> 
		<% } %>	
	<% } %>
    <div class="clear"></div>                       
</div></div>                         
</body>
</html>